package day4;

import java.util.Scanner;

public class te3 {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        System.out.println("请输入一个整数：");
        int number = sc.nextInt();
        int k,i;
        for( k=1 ;; k++){
            if(k*k<=number && (k+1)*(k+1)>number) break;
        }
        for(i=2 ; i<=k ; i++){
            if(number % i ==0 ) {
                break;
            }
        }
        if(i != k+1) System.out.println(number + "不是质数");
        else System.out.println(number + "是质数");
    }
}
